let upPwd = document.querySelector('.updapwd')

upPwd.addEventListener('submit', (e) => {
  e.preventDefault();
  console.log(1);
  let formData = new FormData(upPwd);
  console.log(formData.get('oldPwd'));

  

  axios({
    method: 'post',
    url: '/my/updatepwd',
    data: {
      oldPwd: formData.get('oldPwd'),
      newPwd: formData.get('newPwd')
    }, 
     transformRequest: [function (data) {
        let ret = ''
        for (let it in data) {
          ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
        }
        return ret
      }],
  }).then(res => {
    console.log(res);
    localStorage.removeItem('Token')
    alert(`${res.data.message}请重新登录`)
    window.parent.location.href='../login.html'

    

  })

})
